package org.meruvian.yama.validator;

import org.meruvian.yama.form.PersonForm;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
*
* @author vick
*/
public class PersonValidator implements Validator{
	
	public boolean supports(Class<?> clazz){
        return PersonForm.class.equals(clazz);
    }
	
	public void validate(Object val, Errors errors){
        ValidationUtils.rejectIfEmpty(errors, "firstName", "firstName.empty");
        ValidationUtils.rejectIfEmpty(errors, "lastName", "lastName.empty");
        ValidationUtils.rejectIfEmpty(errors, "gender", "gender.empty");
//        ValidationUtils.rejectIfEmpty(errors, "birthDate", "birthDate.empty");
        ValidationUtils.rejectIfEmpty(errors, "status", "status.empty");
        //ValidationUtils.rejectIfEmpty(errors, "parent", "parent.empty");
        
    }
	
}
